<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=0">
    <link rel="shortcut icon" type="image/x-icon" href="assets/img/favicon.ico">
    <title>Preclinic - Medical & Hospital - Bootstrap 4 Admin Template</title>
    <link rel="stylesheet" type="text/css" href="assets/css/bootstrap.min.css">
    <link rel="stylesheet" type="text/css" href="assets/css/font-awesome.min.css">
    <link rel="stylesheet" type="text/css" href="assets/css/dataTables.bootstrap4.min.css">
    <link rel="stylesheet" type="text/css" href="assets/css/select2.min.css">
    <link rel="stylesheet" type="text/css" href="assets/css/bootstrap-datetimepicker.min.css">
    <link rel="stylesheet" type="text/css" href="assets/css/style.css">
    <!--[if lt IE 9]>
		<script src="assets/js/html5shiv.min.js"></script>
		<script src="assets/js/respond.min.js"></script>
	<![endif]-->
</head>

<body>
            <div class="content">
                <div class="row">
                    <div class="col-sm-8 col-5">
                        <h4 class="page-title">开支</h4>
                    </div>
                    <div class="col-sm-4 col-7 text-right m-b-30">
                        <a href="add-expense.html" class="btn btn-primary btn-rounded float-right"><i class="fa fa-plus"></i> 新增开支</a>
                    </div>
                </div>
                <div class="row filter-row">
                    <div class="col-sm-6 col-md-3 col-lg-3 col-xl-2 col-12">
                        <div class="form-group form-focus">
                            <label class="focus-label">资产名称</label>
                            <input type="text" class="form-control floating">
                        </div>
                    </div>
                    <div class="col-sm-6 col-md-3 col-lg-3 col-xl-2 col-12">
                        <div class="form-group form-focus select-focus">
                            <label class="focus-label">采购人</label>
                            <input type="text" class="form-control floating">
                        </div>
                    </div>
                    <div class="col-sm-6 col-md-3 col-lg-3 col-xl-2 col-12">
                        <div class="form-group form-focus select-focus">
                            <label class="focus-label">付款人</label>
                            <input type="text" class="form-control floating">
                        </div>
                    </div>
                    <div class="col-sm-6 col-md-3 col-lg-3 col-xl-2 col-12">
                        <div class="form-group form-focus">
                            <label class="focus-label">从</label>
                            <div class="cal-icon">
                                <input class="form-control floating datetimepicker" type="text">
                            </div>
                        </div>
                    </div>
                    <div class="col-sm-6 col-md-3 col-lg-3 col-xl-2 col-12">
                        <div class="form-group form-focus">
                            <label class="focus-label">到</label>
                            <div class="cal-icon">
                                <input class="form-control floating datetimepicker" type="text">
                            </div>
                        </div>
                    </div>
                    <div class="col-sm-6 col-md-3 col-lg-3 col-xl-2 col-12">
                        <a href="#" class="btn btn-success btn-block"> 查询 </a>
                    </div>
                </div>
                <div class="row">
                    <div class="col-md-12">
                        <div class="table-responsive">
                            <table class="table table-striped custom-table mb-0 datatable">
                                <thead>
                                    <tr>
                                        <th>资产</th>
                                        <th>费用发生单位</th>
                                        <th>发生日期</th>
                                        <th>发生人</th>
                                        <th>金额</th>
                                        <th>支付人</th>
                                        <th class="text-center">状态</th>
                                        <th class="text-right">操作</th>
                                    </tr>
                                </thead>
                                <tbody id="expense">                                    
                                </tbody>
                            </table>
                        </div>
                    </div>
                </div>
            </div>
            
		<div id="delete_expense" class="modal fade delete-modal" role="dialog">
			<div class="modal-dialog modal-dialog-centered">
				<div class="modal-content">
					<div class="modal-body text-center">
						<img src="assets/img/logo-dark.png" alt="" width="50" height="46">
						<h3>Are you sure want to delete this expense?</h3>
						<div class="m-t-20"> <a href="#" class="btn btn-white" data-dismiss="modal">Close</a>
							<button type="submit" class="btn btn-danger">Delete</button>
						</div>
					</div>
				</div>
			</div>
		</div>

    <div class="sidebar-overlay" data-reff=""></div>
    <script src="assets/js/jquery-3.2.1.min.js"></script>
	<script src="assets/js/popper.min.js"></script>
    <script src="assets/js/bootstrap.min.js"></script>
    <script src="assets/js/jquery.dataTables.min.js"></script>
    <script src="assets/js/dataTables.bootstrap4.min.js"></script>
    <script src="assets/js/jquery.slimscroll.js"></script>
    <script src="assets/js/select2.min.js"></script>
    <script src="assets/js/moment.min.js"></script>
    <script src="assets/js/bootstrap-datetimepicker.min.js"></script>
    <script src="assets/js/app.js"></script>
	<!--json data-->
	<script type="text/javascript" src="json/expense.json"></script>
	<script type="text/javascript">
	$(document).ready(function () {	
		var expenseStr = "";
		for(var i = 0; i < expenses.length; i++){
			expenseStr = expenseStr + '<tr>';
            expenseStr = expenseStr + '<td>';
            expenseStr = expenseStr + '<strong>'+ expenses[i].assetName +'</strong>';
            expenseStr = expenseStr + '</td>';
            expenseStr = expenseStr + '<td>'+ expenses[i].purch +'</td>';
            expenseStr = expenseStr + '<td>'+ expenses[i].purDate +'</td>';
            expenseStr = expenseStr + '<td>'+ expenses[i].purby +'</td>';
            expenseStr = expenseStr + '<td>￥'+ expenses[i].amount +'</td>';
            expenseStr = expenseStr + '<td>'+ expenses[i].expby +'</td>';
            expenseStr = expenseStr + '<td class="text-center">';
            expenseStr = expenseStr + '<div class="dropdown action-label">';
            expenseStr = expenseStr + '<a class="custom-badge ';
			if(expenses[i].status == "等待"){
				expenseStr = expenseStr + 'status-red';
			}else if(expenses[i].status == "同意"){
				expenseStr = expenseStr + 'status-green';
			}
			expenseStr = expenseStr + ' dropdown-toggle" href="#" data-toggle="dropdown" aria-expanded="false">'+ expenses[i].status +'</a>';
            expenseStr = expenseStr + '<div class="dropdown-menu dropdown-menu-right">';
            expenseStr = expenseStr + '<a class="dropdown-item" href="#">等待</a>';
            expenseStr = expenseStr + '<a class="dropdown-item" href="#">同意</a>';
            expenseStr = expenseStr + '</div>';
            expenseStr = expenseStr + '</div>';
            expenseStr = expenseStr + '</td>';
            expenseStr = expenseStr + '<td class="text-right">';
            expenseStr = expenseStr + '<div class="dropdown dropdown-action">';
            expenseStr = expenseStr + '<a href="#" class="action-icon dropdown-toggle" data-toggle="dropdown" aria-expanded="false"><i class="fa fa-ellipsis-v"></i></a>';
            expenseStr = expenseStr + '<div class="dropdown-menu dropdown-menu-right">';
            expenseStr = expenseStr + '<a class="dropdown-item" href="edit-expense.html"><i class="fa fa-pencil m-r-5"></i> 编辑</a>';
            expenseStr = expenseStr + '<a class="dropdown-item" href="#" data-toggle="modal" data-target="#delete_expense"><i class="fa fa-trash-o m-r-5"></i> 删除</a>';
            expenseStr = expenseStr + '</div>';
            expenseStr = expenseStr + '</div>';
            expenseStr = expenseStr + '</td>';
            expenseStr = expenseStr + '</tr>';
		}
		$("#expense").html(expenseStr);
	});
	</script>
</body>

</html>